/*   Copyright 2012 Fernando Moreno Ruiz All Rights Reserved.
 *
 * 	 This file is part of pyPhotosMixer.
 *
 *   pyPhotosMixer is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   pyPhotosMixer is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with pyPhotosMixer.  If not, see <http://www.gnu.org/licenses/>.
 * */
import QtQuick 1.1
import "../javascript/Date.js" as JsDate
Item {
    id: ferFormat
    property string time: ""
    property string date: ""
    property string cameraName: ""
    property string number: ""
    property string file:""
    property variant d_date
    property string dateShow: ""
    function getFerFormat(){
        return "("+date+")["+time+"]-"+cameraName+"["+number+"]"
    }
    onFileChanged: {
        var i_before = -1
        var i_after = -1
        i_before = fileName.indexOf("(") + 1
        i_after = fileName.indexOf(")")
        date = fileName.substring(i_before,i_after)
        i_before = fileName.indexOf("[") + 1
        i_after = fileName.indexOf("]")
        time = fileName.substring(i_before,i_after)
        i_before = fileName.lastIndexOf("[") + 1
        i_after = fileName.lastIndexOf("]")
        number = fileName.substring(i_before,i_after)
        i_after = i_before - 1
        i_before = fileName.lastIndexOf("-") + 1
        cameraName = fileName.substring(i_before,i_after)
        d_date = JsDate.stringToDatepp(date + " " + time)
        if(date!="" && time !=""){
            dateShow = date.replace(/\-/g,":") +" "+ time.replace(/\./g,":")
        }
    }
}
